package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.controller.Result;
import com.itheima.mapper.UserMapper;
import com.itheima.pojo.PageBean;
import com.itheima.pojo.User;
import com.itheima.service.IUserSevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.itheima.controller.Code.GET_OK;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper,  User> implements IUserSevice {
//    @Autowired
//    private UserMapper userMapper;
//    @Override
//    public Result selectPage(int currentPage, int pageSize) {
//        IPage<User> page = new Page<>(currentPage, pageSize);
//        userMapper.selectPage(page, null);
//        List<User> records = page.getRecords();
//        long total = page.getTotal();
//        PageBean pageBean = new PageBean(records, total);
//        Result result = new Result(GET_OK,pageBean, "分页查询成功");
//        return result;
//    }
}
